<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:86:"D:\wwwroot\fangcms_city_add\public/../application/manage\view\weixin_msg_menu\add.html";i:1491816042;s:80:"D:\wwwroot\fangcms_city_add\public/../application/manage\view\public\header.html";i:1490355172;s:80:"D:\wwwroot\fangcms_city_add\public/../application/manage\view\public\footer.html";i:1474280020;}*/ ?>
<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<link href="__CSS__/style.css" rel="stylesheet"/>
	<title>管理中心</title>

</head>

<body>
<div id="J_ajax_loading" class="ajax_loading">加载中...</div>

<div class="subnav">
    <div class="content_menu ib_a blue line_x">
        <?php if(!empty($sub_menu) OR !empty($big_menu)): if(!(empty($big_menu) || (($big_menu instanceof \think\Collection || $big_menu instanceof \think\Paginator ) && $big_menu->isEmpty()))): if(isset($normal)): ?>
        <a class="add fb" href="<?php echo $big_menu['iframe']; ?>"><em><?php echo $big_menu['title']; ?></em></a>
        <?php else: ?>
    	<a class="add fb J_showdialog" href="javascript:void(0);" data-uri="<?php echo $big_menu['iframe']; ?>" data-title="<?php echo $big_menu['title']; ?>" data-id="<?php echo $big_menu['id']; ?>" data-width="<?php echo $big_menu['width']; ?>" data-height="<?php echo $big_menu['height']; ?>"><em><?php echo $big_menu['title']; ?></em></a>
        <?php endif; endif; if(!(empty($sub_menu) || (($sub_menu instanceof \think\Collection || $sub_menu instanceof \think\Paginator ) && $sub_menu->isEmpty()))): if(is_array($sub_menu) || $sub_menu instanceof \think\Collection || $sub_menu instanceof \think\Paginator): $key = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($key % 2 );++$key;if($key != 1): ?><span>|</span><?php endif; ?>
        <a href="<?php echo $val['url']; ?>" class="<?php echo $val['class']; ?>"><em><?php echo $val['name']; ?></em></a>
        <?php endforeach; endif; else: echo "" ;endif; endif; endif; ?>
    </div>
</div>

<!--添加栏目-->
	<form id="info_form" action="<?php echo url('addDo'); ?>" method="post">
		<div class="pad_lr_10">
			<div class="col_tab">
				<ul class="J_tabs tab_but cu_li">
					<li class="current">添加菜单</li>
				</ul>
				<div class="J_panes">
					<div class="content_list pad_10">
						<table width="100%" class="table_form">
							<tr>
								<th width="120">上级菜单 :</th>
								<td>
									<select class="J_cate_select mr10" data-pid="0" data-uri="<?php echo url('ajaxGetchilds'); ?>" data-selected="<?php echo $spid; ?>"></select>
									<input type="hidden" name="pid" id="J_cate_id" />
									<span>默认为一级菜单</span>
								</td>
							</tr>
							<tr>
								<th>菜单事件 :</th>
								<td>
									<select name="type" id="type" onchange="hideUrl(this);">
										<?php if(is_array($typeArr) || $typeArr instanceof \think\Collection || $typeArr instanceof \think\Paginator): $i = 0; $__LIST__ = $typeArr;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
										<option value="<?php echo $key; ?>"><?php echo $vo; ?></option>
										<?php endforeach; endif; else: echo "" ;endif; ?>
									</select>
									<span>含有子菜单的一级菜单 可选择无</span>
								</td>
							</tr>
							<tr>
								<th>菜单名称 :</th>
								<td>
									<input type="text" name="name" id="name" placeholder="一级最多4个字符 二级最多7个字符" class="input-text" size="30">
									（可创建最多 3 个一级菜单，每个一级菜单下可创建最多 5 个二级菜单）
								</td>
							</tr>
							<tr id="tr_url" style="display:none;">
								<th>链接地址 :</th>
								<td>
									<input type="text" name="url" id="url" class="input-text" size="30"><span>以'http://'开头，例：http://fangcms.com</span>
								</td>
							</tr>
							<tr>
								<th>菜单别名 :</th>
								<td>
									<input type="text" name="alias" id="alias" class="input-text" size="20"><span>事件类型为推送事件或拍照发图时请设置菜单别名</span>
								</td>
							</tr>

						</table>
					</div>
				</div>
				<div class="mt10">
					<input value="提交" id="dosubmit" name="" class="btn btn_submit" style="margin:0 10px 0 100px;" type="submit">
					<input type="button" class="btn" value="返回" onclick="location.href='<?php echo url("index"); ?>'">
				</div>
			</div>
		</div>
	</form>
<script src="__PUBLIC__/js/jquery.min.1.7.2.js"></script>
<script src="__JS__/manage.js"></script>
<script src="__JS__/admin.js"></script>
<script>
//初始化弹窗
(function (d) {
    d['okValue'] = '确定';
    d['cancelValue'] = '取消';
    d['title'] = '标题';
})($.dialog.defaults);
</script>
<script src="__PUBLIC__/js/plugins/formvalidator.js"></script>
<?php if(isset($list_table)): ?>
<script src="__PUBLIC__/js/plugins/listTable.js"></script>
<script>
$(function(){
	$('.J_tablelist').listTable();
});
</script>
<?php endif; ?>
<script>
$(function(){
	$.formValidator.initConfig({formid:"info_form",autotip:true});
	$("#name").formValidator({onshow:'请填写名称',onfocus:'请填写名称'}).inputValidator({min:1,onerror:'请填写名称'});
	$("#alias").formValidator({onshow:'请填写菜单别名',onfocus:'请填写菜单别名',empty:true,onempty:''}).regexValidator({regexp:'username',datatype:'enum',onerror:'别名只能为数字、字母、或下划线组成'});
	$('.J_cate_select').cate_select({level:1});
	$('#info_form').ajaxForm({success:complate,dataType:'json'});
	function complate(result){
		if(result.status == 1){
			$.yingloujie.tip({content:result.msg, icon:'success'});
			document.getElementById('info_form').reset();
			setTimeout(function(){window.location.reload()},3000);
		} else {
			$.yingloujie.tip({content:result.msg, icon:'error'});
		}
	}
	

});
	function hideUrl(o){
		if(o.value == 'view'){
			$("#tr_url").show();
		}else{
			$("#tr_url").hide();
		}
	}
</script>
